package com.freshcity.manager
{
	import com.freshcity.ISkinStyle;
	import com.pblabs.core.IPBManager;
	
	import fl.core.UIComponent;
	import fl.managers.StyleManager;
	
	import flash.text.TextFormat;
	import flash.utils.Dictionary;

	public class SkinManager implements IPBManager
	{
		private var _skinCollection:Object={
			//"buttonA":FButton_upSkin_A
		};  
		
		private var _skinObject:Dictionary = new Dictionary();
		
		public function destroy():void
		{
			// TODO Auto Generated method stub
		}
		
		public function initialize():void
		{
			var defaultFormat:TextFormat = new TextFormat("宋体",12,0);
			StyleManager.setStyle("textFormat",defaultFormat);
			
			for(var i:String in _skinCollection) {  
				addStyleSkin(i,_skinCollection[i]);
				} 
		}
		
		public function addStyleSkin(arg1:String, arg2:Object):void
		{
			_skinObject[arg1] = arg2;
		}
		
		public function getStyleSkin(arg1:String):Object
		{
			return _skinObject[arg1];
		}
		
		public function removeStyleSkin(arg1:String):void
		{
			_skinObject[arg1] = null;
			delete _skinObject[arg1];
		}
		
		public function setComponentStyle(arg1:UIComponent, arg2:String):void
		{
			var loc2:*=null;
			var loc1:*=_skinObject[arg2] as Class;
			if (loc1) 
			{
				(loc2 = new loc1() as ISkinStyle).setStyle(arg1);
			}
		}		
	}
}